package com.wgo.precise.client.ui.view.session;


import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;

import com.wgo.precise.client.ui.controller.RequirementPlugin;
import com.wgo.precise.client.ui.view.util.ViewerAction;


/**
 * 
 * @author Petter L. H. Eide
 * @version $Id: LoginAction.java,v 1.1 2006-01-23 19:58:36 petterei Exp $
 */
public class LoginAction extends ViewerAction{

    private LoginDialog loginDialog;
    
    public LoginAction(IWorkbenchWindow window) {
        super("Login");
        init(window) ;
        setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_DEF_VIEW));
    }

    public void init(IWorkbenchWindow window) {
        loginDialog = new LoginDialog(window.getShell(), RequirementPlugin.getInstance());
        setToolTipText("Log in to server.");
    }

    @Override
    public void run() {
        loginDialog.open();
        RequirementPlugin.getInstance().getPreciseSubject().notifyModelChanged(null);
        super.run();
    }

}
